package com.hch.web;

import com.hch.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class ArchiveShowController {

    @Autowired
    private BlogService blogService;

    @GetMapping("/archive")
    public String archives(Model model) {
        //归档：年份对应博客集合的Map
        model.addAttribute("archiveMap",blogService.archiveBlog());
        //归档博客数目
        model.addAttribute("blogCount",blogService.blogCount());
        return "archive";
    }

}
